package bma.common.netty.webserver.matcher;

import java.util.regex.Pattern;

import bma.common.netty.webserver.Matcher;

public class MatcherRegex implements Matcher {

	private Pattern pattern;

	public MatcherRegex() {
		super();
	}

	public MatcherRegex(String v) {
		super();
		setPattern(v);
	}

	public Pattern getPattern() {
		return pattern;
	}

	public void setPattern(String v) {
		this.pattern = Pattern.compile(v);
	}

	@Override
	public boolean match(String v) {
		if (this.pattern == null)
			return false;
		return pattern.matcher(v).matches();
	}

}
